package com.app.designpatternslearn.structured.adapterpattern.code

class MediaAdapter(mediaType: MediaType):MediaPlayer {

    private val advancedMediaPlayer: AdvancedMediaPlayer? = when(mediaType) {
        MediaType.MP4->Mp4Player()
        MediaType.VLC->VlcPlayer()
        else -> null
    }

    override fun play(mediaType: MediaType, fileName: String){
        when(mediaType) {
            MediaType.VLC->advancedMediaPlayer?.playVlc(fileName)
            MediaType.MP4->advancedMediaPlayer?.playMp4(fileName)
            else -> println("not implement this mediaType")
        }

    }
}